"""
类定义
"""


class Goods:
    # 类属性
    count = 0
    id_count = 0

    # 类方法，参数是类class
    @classmethod
    def generate_id(cls):
        cls.id_count += 1
        return cls.id_count

    """
    构造函数
    """

    def __init__(self):
        Goods.count += 1
        self.id = str(self.generate_id()).zfill(5)
        self.name = ''
        self.price = 0
        self.discount = 1


g1 = Goods()
g2 = Goods()
g3 = Goods()

print(g3.count, g3.id)
